<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>救助信息修改</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="css/font_eolqem241z66flxr.css" media="all" />

</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote" style="border-left: 5px solid #ffffff">
    <fieldset class="layui-elem-field">
        <legend>救助信息修改</legend>
        <div class="layui-field-box">

            <a href="help.html">
                <button class="layui-btn" style="background-color: #1E9FFF">返回上一级</button>
            </a>

        </div>
    </fieldset>
</blockquote>
<form class="layui-form">

    <div class="layui-form-item">
        <label class="layui-form-label">事故编号</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input accidentId" name="accidentId" id="accidentId" lay-verify="required" placeholder="请输入事故编号" value="${help.accidentId }">
        </div>

        <label class="layui-form-label">事故名称</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input accidentName" name=accidentName id="accidentName" lay-verify="required" placeholder="请输入事故名称" value="${help.accidentName }">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">救助及时？</label>
        <div class="layui-input-inline">
            <input type="radio" name="timely" id="timely" value="是" title="及时" checked="">
            <input type="radio" name="timely" id="timely2"value="否" title="不及时">
        </div>

        <label class="layui-form-label">救助成功？</label>
        <div class="layui-input-inline">
            <input type="radio" name="successly" id="successly" value="是" title="成功" checked>
            <input type="radio" name="successly"  id="successly2" value="否" title="不成功">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">救助机构</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input helpService" name="helpService" id="helpService" lay-verify="required" placeholder="请输入救助机构名" value="${help.helpService }">
        </div>

        <label class="layui-form-label">救助船只</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input helpBoat" name="helpBoat" id="helpBoat"   placeholder="请输入实施救助船只名称" value="${help.helpBoat }">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">挽回损失</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入挽回的损失，如经济、环境方面" name="loss" id="loss" class="layui-textarea loss" >
           ${help.loss }
            </textarea>
        </div>

    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="reviseHelp">确认修改</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="layui/layui.all.js"></script>
<script src="layui/layui.js"></script>

<script>
layui.use(['form','layer','jquery','layedit','laydate'], function(){
	  var form = layui.form,
	    layer = parent.layer === undefined ? layui.layer : parent.layer,
	    laypage = layui.laypage,
	    layedit = layui.layedit,
	    laydate = layui.laydate,
	    $ = layui.jquery;
	  
        var accidentId = $("#accidentId").val();
        $.get("helpSurveryRevise2?accidentId="+accidentId,function(data){
  		  if(data.timely == "是"){
  			  $("#timely")[0].checked=true;
  		  }else{
  			  $("#timely2")[0].checked=true;
  		  }
  		  if(data.successly == "是"){
  			  $("#successly")[0].checked=true;
  		  }else{
  			  $("#successly2")[0].checked=true;
  		  }
  		  form.render('radio');
  		  form.render('select');
  	  });
  	  laydate.render({
  		    elem: '#date' //指定元素
  		  });
  	  form.render('select');
  	  form.render();
		
  		//监听提交
      form.on('submit(reviseHelp)', function(data) {
          var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
          $.ajax({
          	contentType:'application/x-www-form-urlencoded; charset=UTF-8',
          	url : "help/reviseHelp",
          	type : "post",
          	data : data.field,
          	dataType : "json"
          })
          //弹出loading
          var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
          setTimeout(function(){
              top.layer.close(index);
              top.layer.msg("信息修改成功！");
              layer.closeAll("iframe");
              //刷新父页面
              parent.location.reload();
          },2000);
          return false;
      })
    });
</script>
</body>
</html>